package com.ribbon;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangjing on 2018/7/20.
 */

@RestController
public class ConsumerController {

//    @Autowired
//    private RestTemplate restTemplate;
//
//    @RequestMapping(value = "/ribbon",method = RequestMethod.GET)
//    public String helloConsumer(){
//        return restTemplate.getForEntity(
//                "http://hello-service:8090/hello",String.class).getBody();
//    }

    @Autowired
    private HelloService helloService;

    @RequestMapping(value = "/ribbon-consumer",method = RequestMethod.GET)
    public String helloConsumer() {
        return helloService.helloConsumer();
    }
}
